function [c] = FuncaoCusto(f, y, x, h, lambda, q, e)
    h = ExpandeMatriz(x, h);
    bordas = abs(f + e).^q;
    prior  = y-conv2(h,x,'same');
    
    c = (1/2) * sum(sum(prior.^2)) + lambda * sum(sum(bordas));
    
end